<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:oso="http://osoftware.com/facelets"
	template="/WEB-INF/templates/mainSearchLayout.xhtml">

	<ui:define name="title">
			<h:outputText value="#{resourceBundle['patientLog.title']}" />
	</ui:define>
	
	<ui:define name="searchFields">
		<oso:selectOneMenu id="patientFilter" 
			label="#{resourceBundle['patientLog.patient']}"
			value="#{patientLogModel.filter.patient}" 
			converter="patientConverter"
			items="#{patientLogModel.selectablePatients}" 
			itemLabel="fullName"/>
	</ui:define>

	<ui:define name="listValues">
		<h:commandLink id="pdf" rendered="false">
			<p:graphicImage value="/images/pdf.png" />
			<p:dataExporter type="pdf" target="listTable" fileName="cars" preProcessor="#{patientLogController.preProcessPDF}"/>
		</h:commandLink>
		<ui:param name="listModel" value="#{patientLogModel.list}" />
		<ui:param name="targetObject" value="#{patientLogModel.editedEntity}" />
	</ui:define>

	<ui:define name="searchColumns">
		<p:column sortBy="#{row.date}">
			<f:facet name="header">
				<h:outputText value="#{resourceBundle['patientLog.date']}" />
			</f:facet>
			<h:outputText value="#{row.date}" >
				<f:convertDateTime pattern="dd/MM/yyyy HH:mm" />
			</h:outputText>
		</p:column>	
		<p:column sortBy="#{row.specialist.fullName}">
			<f:facet name="header">
				<h:outputText value="#{resourceBundle['patientLog.specialist']}" />
			</f:facet>
			<h:outputText value="#{row.specialist.fullName}" />
		</p:column>
		<p:column exportable="false">
			<p:rowToggler />  
		</p:column>
		
		<p:rowExpansion >
			<h:panelGrid>
				<h:outputText value="#{row.log}" escape="false"/>
			</h:panelGrid>
		</p:rowExpansion>
	</ui:define>
	
</ui:composition>